package com.shine.app.ui;

import android.content.Intent;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.widget.TextView;

import com.shine.app.AppManager;
import com.shine.app.BaseActivity;
import com.shine.app.R;
import com.shine.app.inject.InjectView;
import com.shine.app.inject.Injector;

public class LocationDialogActivity extends BaseActivity implements
		OnClickListener {

	@InjectView(R.id.cancel)
	private TextView cancelTextView;
	@InjectView(R.id.submit)
	private TextView submiTextView;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		this.requestWindowFeature(Window.FEATURE_NO_TITLE);
		this.setContentView(R.layout.dialog_location);
		Injector.get(this).inject();
		cancelTextView.setOnClickListener(this);
		submiTextView.setOnClickListener(this);
	}

	@Override
	public void onClick(View view) {
		Intent intent = new Intent();
		if (cancelTextView == view) {
			intent.putExtra("result", false);
		} else if (submiTextView == view) {
			intent.putExtra("result", true);
		}
		setResult(RESULT_OK, intent);
		AppManager.getAppManager().finishActivity();
		overridePendingTransition(R.anim.anim, R.anim.slide_out_down);
	}

	@Override
	public boolean onKeyDown(int keyCode, KeyEvent event) {
		return false;
	}
}
